<{*丸子妈妈——积分商城首页 列表形式*}>
<{include file="top.html" }>
</head>
<body>
<{include file="wap_index_top.html" }>
<{*轮播 开始*}>
<div class="flicking_con" >
    <div class="flicking_inner">
        <{foreach from=$marquee key=key item=item}>
        <a href="<{u('index/marqueJump?id='|cat:$item.id)}>"><{$key}></a>
        <{/foreach}>

    </div>
</div>
<div class="main_image">
    <ul>
        <{foreach from=$marquee item=item}>
        <li><a href="<{u('index/marqueJump?id='|cat:$item.id)}>"><img src="<{$preUploadUrl}><{$item.pic}>"></a></li>
        <{/foreach}>
    </ul>
    <a href="javascript:;" id="btn_prev"></a>
    <a href="javascript:;" id="btn_next"></a>
</div>
<{*轮播 结束*}>
    <ul class="nav">
        <li><a class="integration" href="<{U('Point/pointDetail')}>"><i><{$userinfo.point}></i>积分</a></li>
        <li><a class="record" href="<{U('PointMall/exchangeLog')}>">兑换记录</a></li>
        <li><a class="rule" href="<{$POINT_RULE_URL}>">积分规则</a></li>
        <{if $switch==1}><li><a class="luckDraw" href="<{U('PointMall/dialLottery')}>">积分抽奖</a></li><{/if}>
    </ul>

<{if $list}>
    <ul class="wddh_list">
        <{include file="PointMall/indexMore.html"}>
    </ul>
    <div id="load_container">
        <a href="javascript:load_more();" id="load_more"><span>加载更多</span></a><br>
    </div>
<{else}>
    <div class="none-box">
        <dl>小编正在努力挖掘中，敬请期待……</dl>
        <div class="formerly_box">
            <a  href="<{U('PointMall/endList')}>"><div class="formerly_topic"></div></a>
        </div>
    </div>
<{/if}>

<{include file="signBody.html"}>
    <{include file="footer.html" }>
</body>
</html>
<script type="text/javascript" src="<{$preStaticUrl}>js/jquery.touchSlider.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $(".main_visual").hover(function(){
            $("#btn_prev,#btn_next").fadeIn()
        },function(){
            $("#btn_prev,#btn_next").fadeOut()
        })
        $dragBln = false;
        $(".main_image").touchSlider({
            flexible : true,
            speed : 200,
            btn_prev : $("#btn_prev"),
            btn_next : $("#btn_next"),
            paging : $(".flicking_con a"),
            counter : function (e) {
                $(".flicking_con a").removeClass("on").eq(e.current-1).addClass("on");
            }
        });
        $(".main_image").bind("mousedown", function() {
            $dragBln = false;
        })
        $(".main_image").bind("dragstart", function() {
            $dragBln = true;
        })
        $(".main_image a").click(function() {
            if($dragBln) {
                return false;
            }
        })
        timer = setInterval(function() { $("#btn_next").click();}, 5000);
        $(".main_visual").hover(function() {
            clearInterval(timer);
        }, function() {
            timer = setInterval(function() { $("#btn_next").click();}, 5000);
        })
        $(".main_image").bind("touchstart", function() {
            clearInterval(timer);
        }).bind("touchend", function() {
            timer = setInterval(function() { $("#btn_next").click();}, 5000);
        })

//        setTimeout(function (){timeout();},1000);
        timeout();
        function timeout(){
            var $point_timeer = $('.jkqsj');
            $point_timeer.each(function() {
                var time = parseInt($(this).data("time"));
                if(time>0 && time){
                    output_time(time,this);
                }
                $(this).data("time",--time);
            });
            setTimeout(function (){timeout();},1000);
        }
        function output_time (time,obj) {
                    var hour = Math.floor(time/60/60);
                    var minute = Math.floor((time/60)%60);
                    var scond = Math.floor(time%60);
                    var day = Math.floor(hour/24);

                    if(hour>24){
                        hour = hour%24;
                        $(obj).html("距离开始 "+day+"天"+hour+"小时");
                    }else if(hour > 1 && hour <=24){
                        $(obj).html("距离开始 "+hour+"小时"+minute+"分");
                    }else if(hour <=1){
                        $(obj).html("距离开始 "+minute+"分"+scond+"秒");
                    }
        }
        load_more({page:page,pos:"PointMallIndexMore"});
    });

</script>
<script>
    //拖动加载
    var  flagData  =  true;
    var  flagAjax  =  true;
    var  page      =  2;
    //加载
    function  load_more(postData){
        $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
        $("#load_more  span").html('正在加载...');
        if(! flagAjax){
            return  false;
        }
        flagAjax  =  false;
        $.post("<{u('PointMall/indexMore')}>",postData,function(data){
            if(page <= data.totalPage)  {
                $(".wddh_list").append(data.dataHTML);
                $("#load_more  span").html('加载更多');
                page++;
                flagAjax  =  true;
                $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
            }  else  {
                flagData  =  false;
                $("#load_container").html('<div class="formerly_box"><a  href="<{U('PointMall/endList')}>"  id="load_more"><div class="formerly_topic"></div></a></div>');
//                $("#load_more").css({'background':'url("")'}).css({'padding-top':'0'}).css({'top':'0px'}).css({'position':'relative'});
            }
        },'json');
    }
    var  tmp_scroll  =  0;
    //拖动加载
    function  scroll_load(postData){
        if  (tmp_scroll  ==  $(window).height()  +  $(window).scrollTop())  {
            return;
        }
        tmp_scroll  =  $(window).height()  +  $(window).scrollTop();
        var  jia_scroll  =  $(document).height()  -  ($(window).height()  +  $(window).scrollTop());
        if  (jia_scroll  <  100  &&  flagData)  {
            load_more(postData);
        }
    }
    $(window).scroll(function(){
        scroll_load({page:page,pos:"PointMallIndexMore"});
    });
</script>